package com.net.job;

import org.springframework.stereotype.Component;

import com.net.model.UserFlow;
import com.net.model.UserFlowStatData;
import com.net.model.WebsiteFlowStatData;
import com.net.util.SpringUtils;


@Component
public class MonitorOrderJob {

	public void executeInternal() {
		
		UserFlowStatData userFlowStatData = SpringUtils.getBean("user_flow_data");
		System.out.println("用户流量:" + userFlowStatData);
		
		//往用户流量数据区新增一个用户
		String ip = "192.168.3.2";
		UserFlow userFlow = new UserFlow();
		userFlowStatData.getData().put(ip, userFlow);
		System.out.println(userFlowStatData);
		//更新某个用户在第i分钟的流量情况
			int i = 5;//游标
			Double x = 120.3;//流量增加值
		 userFlowStatData.getData().get("ip").getFlowPerMinute()[i] = x;
		 System.out.println(userFlowStatData);
		 //获取某个用户的流量情况
		 Double[] flowPerMinute = userFlowStatData.getData().get("ip").getFlowPerMinute();
		 System.out.println(flowPerMinute);
		
		 
		 
		 WebsiteFlowStatData websiteFlowStatData = SpringUtils.getBean("website_flow_data");
		System.out.println("网站流量:" + websiteFlowStatData);
	}

}
